% IS_INSIDE Logical function that returns whether or not the given point
% (x,y) is part of the unknown figure inside [-2.5,2.5] x [-0.5,3.5]. It is
% known that the area of the figure is 7.9175274853766402778 .
%
% The function is vectorised, so instead of one point (x,y), two vectors xs
% and ys can denote a list of points (xs(i),ys(i)) for i=1:numel(xs). The
% result is a vector of logicals with the same size as xs and ys.
%
% To avoid significant overhead, the input arguments are not checked.
% Please ensure that you provide reasonable inputs...
% 
% Avoid calling this function with more than, say 10000, points. In that
% case the memory access cost will dominate the function call.
%
% USAGE
%
%   >> inside  = is_inside( x ,y  )
%   >> insides = is_inside( xs,ys )
%
% EXAMPLE
%
%   One point:
%   >> is_inside( -1, 0.5 )
%   ans =
%        1
%   >> is_inside( 0.2, 1.5 )
%   ans =
%        0
%
%   Several points:
%   >> is_inside( [-1;0.2;1.5], [0.5;1.5;2.5] )
%   ans =
%        1
%        0
%        1
%
% HISTORY
%
%   2011-04-27 KP - Initial version
%
% AUTHOR
%
%   Koen Poppe, Department of Computer Science,
%   Katholieke Universiteit Leuven, Celestijnenlaan 200A,
%   B-3001 Heverlee, Belgium
%   Email:  Koen.Poppe@cs.kuleuven.be
%
function inside = is_inside( x,y )

% Please, don't try to decipher this, it's not worth it.
inside = (0<=y&y<=143/50&abs(x+9/10)<=10/143*real(((969/800-13/88*y).* ...
    sqrt((286*y-100*y.^2)))))|(y<=29/10&93/50<=y&abs(x-9/20)<=2/143* ...
    real(((53/1600+13/32*y).*sqrt(-13485+11900*y-2500*y.^2))))|(0<=y&y ...
    <=91/50&abs(x-9/10)<=10/143*real(((969/800-13/56*y).*sqrt((182*y- ...
    100*y.^2)))))|(y<=3&17/10<=y&abs(x-3/2)<=10/143*real(((189/800+13/ ...
    40*y).*sqrt((-510+470*y-100*y.^2)))))|(6/5<=y&y<=159/100&abs(x-9/5) ...
    <=2/143*real(((2009/800-13/12*y).*sqrt(-4770+6975*y-2500*y.^2))));